]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspaceAnimation: Sort existing records when restacking
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 28 Apr 2026 12:25:44 +0000 (14:25 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 2 Aug 2026 16:48:23 +0000 (18:48 +0200)
When restacking, we currently re-filter window actors, then match
each to the corresponding record.

Instead, sort the existing records according to the new stacking,
then iterate over those directly.

This reflects more directly that window records are fixed during
the transition, and avoids a (harmless) warning in case a window
only appeared during the animation and therefore cannot be
matched to a record.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/work_items/8881
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4199>
(cherry picked from commit e7e6de300cfb87c0f91738861b545017e5290ef9)

js/ui/workspaceAnimation.js

index f7c2f7a3bb4be4d5ff1537d1fc8971a447cc8802..844bac4511b433c9e3f0b10bc3aac718e77243a3 100644 (file)
@@ -123,15 +123,20 @@ class WorkspaceGroup extends BaseWorkspaceGroup {
     }
 
     _syncStacking() {
-        const windowActors = global.get_window_actors().filter(w =>
-            this._shouldShowWindow(w.meta_window));
+        const stackIndeces = new Map(
+            global.get_window_actors().map((w, i) => [w, i]));
+
+        this._windowRecords.sort((a, b) => {
+            const seqA = a.windowActor;
+            const seqB = b.windowActor;
+
+            return stackIndeces.get(seqA) - stackIndeces.get(seqB);
+        });
 
         let lastRecord;
         const bottomActor = this._background ?? null;
 
-        for (const windowActor of windowActors) {
-            const record = this._windowRecords.find(r => r.windowActor === windowActor);
-
+        for (const record of this._windowRecords) {
             this.set_child_above_sibling(record.clone,
                 lastRecord ? lastRecord.clone : bottomActor);
             lastRecord = record;